<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
<base th:href="@{/}">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<!--style start-->
<th:block th:include ="commHeaderInclude::commHead"></th:block>
<th:block th:include ="commHeaderInclude::formPageComm"></th:block>
<!--style end-->
<title>选择金融产品</title>
</head>

<body class="ht">
<th:block th:include="commHeaderInclude::loading"></th:block>
	<div class="content-wrapper">
		<form class="searchForm" id="searchForm" th:object="${vo.dto}">
			<div class="card" id="searchModule">
				<div class="card-body">
					<h4 class="card-title">按条件查询金融产品</h4>
					<div class="module searchModule">
						<ul class="mb-3">
							<li style="width: 100%;">
								<label>资金方名称</label>
								<div><input type="text" name="bankOrgName" th:value="*{bankOrgName}" placeholder="输入资金方名称" /></div>
							</li>
						</ul>
						<div class="searchBtnContainer ml-4" style="top: 0;">
							<input type="hidden" name="token"  th:value="${session.token}">
							<input class="btn btn-primary" type="submit" id="search" value="查询">
							<input class="btn btn-clear" type="reset" id="clearButton" value="清空">
						</div>
					</div>
				</div>
			</div>
		</form>

		<form name="listForm" id="listForm" class="listForm" method="post" action="hos/finance/productSelector">
			<input  type="hidden" name="productIds" id="selectedIds"  th:value="${productIds}"/>
			<input type="hidden" name="token"  th:value="${session.token}">
			<div class="card mb-3 border-top-0">
				<div class="card-body listModule" id="listModule">
					<h4 class="card-title">待选择金融产品列表</h4>
					<div class="module">
						<table cellpadding="0" cellspacing="0" class="hTable">
							<thead>
								<tr>
									<th>序号</th>
									<th>产品名称</th>
									<th>资金方</th>
									<th>适用区域</th>
									<th>发布时间</th>
									<th>贷款金额（万元）</th>
									<th>贷款期限（月）</th>
									<th>参考利率</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<tr th:each="li,item:${vo.page.list}">
									<td th:text="${item.index+vo.page.startRow}">序号</td>
									<td th:text="${@util.fStr(li.productName)}">产品名称</td>
									<td><a class="textLink-primary" target="_top" role="openFrameWindow" th:href="@{'base/bank/detail?id='+${li.bankOrgId}}" th:text="${@util.fStr(li.bankOrgName)}">6</a></td>
									<td th:text="${li.areaNames}">适用区域</td>
									<td class="time" th:text="${#dates.format(li.publishTime,'yyyy-MM-dd')}">发布时间</td>
									<td class="amount" th:text="${li.amount}">9999</td>
									<td th:text="${@util.fStr(li.timeLimit)}">11</td>
									<td th:text="${@util.fStr(li.rate)}">参考利率</td>
									<td class="selectButton" th:value="${li.id}" ><a class="btn btn-outline-primary btn-sm">选择</a></td>
								</tr>
							</tbody>
						</table>
						<div class="noneRecord" th:if="${vo.page.total==0}">查无记录!</div>
						<th:block th:include="commHeaderInclude::pageInfoComm"></th:block>
					</div>
				</div>
			</div>
		</form>
	</div>
</body>
<script>
var page=new ListPage();
page.init();

$(".selectButton").on("click",function(event){
	var id = $(event.currentTarget).attr("value");
	parent.setProductById(id);
});

$("#clearButton").on("click",function(event){
	$("[name='bankOrgName']").val('');
	return false;
});
</script>
</html>